import random
def firstnummber():
    return a.isdigit() == False or int(a)>100 or int(a)<0
def toohigh(a,b):
    return b.isdigit() == False or int(b)>=a or int(b)<0

def toolow(a,b):
    return b.isdigit() == False or int(b)<=a or int(b)<0


number = random.randint(1, 100)
a = input("Enter a number between 1 and 100: ")
while firstnummber()==True:
    a = input("Please enter a number between 1 and 100: ")
a = int(a)
min = 0
max = 100
while a!=number:
    if a>number:
        print("Too high")
        b = input("Please enter again: ")
        while toohigh(a,b)==True:
            b = input(f"Please enter a number between {min} and {a-1}: ")
        max = a-1
        a = int(b)
    else:
        print("Too low")
        b = input("Please enter again: ")
        while toolow()==True:
            b = input(f"Please enter a number between {a+1} and {max}: ")
        min = a+1
        a = int(b)
print("Correct")
print("Thank you for playing!")
